//
//  DecoratorStream.m
//  DesignMode
//
//  Created by wangzhipan on 2024/9/11.
//

#import "DecoratorStream.h"

@implementation DeFileStream
- (void)read
{
    
}
- (void)seek
{
    
}
- (void)write
{
    
}
@end


@implementation DeMemoryStream
- (void)read
{
    
}
- (void)seek
{
    
}
- (void)write
{
    
}
@end

@implementation DeNetworkStream
- (void)read
{
    
}
- (void)seek
{
    
}
- (void)write
{
    
}
@end

@implementation DeEncryptStream
- (instancetype)initWithStream:(id<IDecoratorStream>)stream
{
    if (self = [super init]) {
        _stream = stream;
    }
    return self;
}

- (void)read
{
    //先进行加密操作
    [self.stream read];
}
- (void)seek
{
    //先进行加密操作
    [self.stream seek];
}
- (void)write
{
    //先进行加密操作
    [self.stream write];
}
@end

@implementation DeDecodeStream
- (instancetype)initWithStream:(id<IDecoratorStream>)stream
{
    if (self = [super init]) {
        _stream = stream;
    }
    return self;
}

- (void)read
{
    //先进行解密操作
    [self.stream read];
}
- (void)seek
{
    //先进行解密操作
    [self.stream seek];
}
- (void)write
{
    //先进行解密操作
    [self.stream write];
}
@end

@implementation DeBufferStream
- (instancetype)initWithStream:(id<IDecoratorStream>)stream
{
    if (self = [super init]) {
        _stream = stream;
    }
    return self;
}

- (void)read
{
    //先进行缓冲操作
    [self.stream read];
}
- (void)seek
{
    //先进行缓冲操作
    [self.stream seek];
}
- (void)write
{
    //先进行缓冲操作
    [self.stream write];
}
@end
